package com.cskaoyan.controller.wx;

import com.cskaoyan.bean.MarketBrand;
import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.bean.common.CommonData;
import com.cskaoyan.mapper.MarketBrandMapper;
import com.cskaoyan.service.MarketBrandService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("wx/brand")
public class WxBrandController {
    @Autowired
    MarketBrandService brandService;

    @RequestMapping("list")
    public BaseRespVo list(Integer page, Integer limit) {
        List<MarketBrand> marketBrand = brandService.selectBrand(page,limit);

        PageInfo pageInfo = new PageInfo(marketBrand);
        CommonData data = CommonData.data(pageInfo);

        return BaseRespVo.ok(data);
    }

    @RequestMapping("detail")
    public BaseRespVo detail(Integer id) {
        MarketBrand marketBrand = brandService.selectBrandById(id);
        return BaseRespVo.ok(marketBrand);
    }
}
